package com.ly.share.juc.statistics;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author icanci
 * @since 1.0 Created in 2022/06/06 21:22
 */
public class AtomicIntegerDemo extends AbstractLockDemo {
    private static final AtomicInteger ATOMIC_INTEGER = new AtomicInteger(0);

    public static void main(String[] args) {
        AtomicIntegerDemo lockDemo = new AtomicIntegerDemo();
        Integer theSum = lockDemo.log(() -> {
            for (int i = 0; i < count; i++) {
                ATOMIC_INTEGER.incrementAndGet();
            }
            return ATOMIC_INTEGER.get();
        });

        System.out.println(theSum);
    }
}
